//
// Created by 30986 on 2020/9/23.
//素数

#include "primes.h"
#include <iostream>
#include<iomanip>
#include<math.h>
using namespace std;
int main(){
    long a,b,l=0;
    cout<<"please input two numbers:\n";
    cin>>a>>b;
    cout<<"primes from "<<a<<" to "<<b<<" is:\n";

    //处理
    if(a%2==0)  //单判唯一的一个偶数素数，是则增1
        a++;
    for(long m=a;m<=b;m+=2){ //步长为2
        int sqrtm=sqrt(m);
        int i;
        for(i=2;i<=sqrtm;i++) //只检查到根号m
            if(m%i==0)break;

        if(i>sqrtm){  //输出 十个数换一行
            if(l++%10==0)
                cout<<endl;
            cout<<setw(5)<<m;
        }
    }
    return 0;
}